﻿<UserControl x:Class="LiSAClient.WpfClient.View.Projects.Edit.EditSearchstrings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Width="800" Height="700">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width ="*"/>
            <ColumnDefinition Width="300"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="20"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <!--Caption-->
        <Label Grid.Column="0" Grid.Row="0" Content="Search Strings" Style="{StaticResource PageCaption}"/>

        <!--Dispaly added criteria-->
        <DataGrid Grid.Column="0" Grid.Row="1" Name="CriteriaDataGrid" ItemsSource="{Binding Project.SearchStrings}"  Style="{StaticResource DataGridStyle}"
                      AutoGenerateColumns="False" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" SelectionMode="Single" SelectionUnit="FullRow" 
                     SelectedItem="{Binding SelectedSearchString, Mode=TwoWay}">
            <DataGrid.Columns>
                <DataGridTextColumn Width="150" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding SearchString}" Header="SearchString" ElementStyle="{StaticResource DataGridTextColumnElementStyle}" />
                <DataGridTextColumn MinWidth="200" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Comment}" Header="Comment" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                <DataGridTextColumn Width="150" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Classification}" Header="Classification" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
            </DataGrid.Columns>
            <!--<DataGrid.InputBindings>
                <MouseBinding Gesture="LeftDoubleClick" Command="{Binding ShowSelection}"/>
            </DataGrid.InputBindings>-->
        </DataGrid>

        <!--Allow new criteria-->
        <Grid Grid.Row="1" Grid.Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>


            <!--SearchString-->
            <Label Grid.Column="0" Grid.Row="0" Content="Search String" Style="{StaticResource InformationCaption}"/>
            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding SearchString.SearchString, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource EditableTextBox}" TabIndex="0" TextWrapping="Wrap" AcceptsReturn="True" Height="300"/>

            <!--Comment-->
            <Label Grid.Column="0" Grid.Row="1" Content="Comment" Style="{StaticResource InformationCaption}"/>
            <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding SearchString.Comment, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource EditableTextBox}" TabIndex="1" TextWrapping="Wrap" AcceptsReturn="True" Height="100"/>

            <!--Classification-->
            <Label Grid.Column="0" Grid.Row="2" Content="Classification" Style="{StaticResource InformationCaption}"/>
            <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding SearchString.Classification, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource EditableTextBox}" TabIndex="2" AcceptsReturn="True"/>


            <!--SubmitButton-->
            <Button Grid.Row="3" Grid.Column="1" Name="ButtonNewSearchStringv" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding AddNewSearchString}" TabIndex="3" Content="Add SearchString" IsDefault="True"/>
        </Grid>
    </Grid>
</UserControl>